package com.xin.springclouduser.repository;

import com.xin.springclouduser.dataobject.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface UserRepository extends JpaRepository<User,String> {
    /**
     * 模糊分页查询
     * @param nickname
     * @param pageable
     * @return
     */
    @Query("select u from User u where u.nickname like concat('%',:nickname,'%')")
    Page<User> findAll(@Param("nickname") String nickname, Pageable pageable);

    User findByPhone(String phone);


}
